#include "cJSON.h"
#include <stdio.h>

int main(int argc, char const *argv[])
{
    // 字符串转对象,提取对应的值
    cJSON *root = cJSON_Parse("{\"name\":\"zhangsan\",\"age\":18,\"sex\":\"man\"}");
    if (root == NULL)
    {
        printf("cJSON_Parse error");
    }
    cJSON *name = cJSON_GetObjectItem(root, "name");
    cJSON *age = cJSON_GetObjectItem(root, "age");
    printf("name:%s,age:%d\r\n", name->valuestring, age->valueint);
    return 0;
}
